home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 April / EnigmA AMIGA RUN 17 (1997)(G.R. Edizioni)(IT)[!][issue 1997-04][EAR-CD].iso / EARCD / comm / bbs / citsrc6K05.lha / test.c < prev    next >
C/C++ Source or Header  |  1996-11-05  |  2KB  |  87 lines

  1. /*  Citadel Verify Database */
  2. #include <stdio.h>
  3. #include <string.h>
  4. #include "ctdl.h"
  5. char netDebug      = '\0';
  6. char logNetResults = '\0';
  7. FILE  *netLog = stdout;
  8.  
  9. extern CONFIG      cfg;            /* A buncha variables           */
  10. extern FILE            *netfl, *roomfl;
  11. extern MessageBuffer  msgBuf; /* The -sole- message buffer      */
  12. extern FILE *msgfl, *msgfl2;
  13.  
  14. void Process_Msg(MessageBuffer  *msg);
  15. void Do_Room_Stats(long total);
  16. void Print_Counts(struct counts *ptr );
  17. void Do_Message(MessageBuffer  *);
  18. void Verify_Messages(void);
  19. int MsgLen(MessageBuffer  *);
  20. void Verify_Room(void);
  21. void crashout(char *);
  22.  
  23. int  mPrintf(char *format, ...) {return 0; }  /* stub to quiet the linker */
  24.  
  25.  
  26. void crashout(str)
  27. char *str;
  28.   {
  29.   printf(str);
  30.   exit(10);
  31.  
  32.   }
  33. int  main(int,char **);
  34. int  main(argc,argv)
  35. int  argc;
  36. char **argv;
  37.   {
  38.   /* Process CONFIG  */
  39.   cfg.weAre = UTILITY;
  40.   printf("Citadel Vortex Unit Test Version %s\n", VERSION_NAME);
  41.   if (!readSysTab(FALSE, TRUE)) exit(100);
  42.   VortexInit();
  43.   InitVortexing();
  44.   Verify_Messages();    /* process the messages */
  45.   FinVortexing();
  46.   printf(msgBuf.mbtext);
  47.   return 0;
  48.   }
  49.  
  50. void Verify_Messages()
  51.   {
  52.   MSG_NUMBER msg, firstMessage;
  53.   int total=1;     /* For stat keeping. */
  54.   int bad=0;
  55.   extern struct mBuf mFile1;
  56.   fprintf(stderr, "Mulching...\n");
  57.   InitMsgBase();
  58.   startAt(msgfl, &mFile1, 0, 0);
  59.   getMessage(getMsgChar, FALSE, TRUE, TRUE);
  60.   firstMessage = atol(msgBuf.mbId);
  61.   if( !NotVortex() )
  62.     {
  63.     printf(" Author:%s from %s rejected.\n", msgBuf.mbauth,  msgBuf.mboname);
  64.     printf(" Id: %s  Date: %s  Time: %s  Room: %s\n",
  65.     msgBuf.mbId, msgBuf.mbdate, msgBuf.mbtime, msgBuf.mbroom);
  66.     bad++;
  67.     };
  68.   msg = firstMessage -1;
  69.   while (msg != firstMessage)
  70.     {
  71.     total++;
  72.     getMessage(getMsgChar, FALSE, TRUE, TRUE);
  73.     if( !NotVortex() )
  74.       {
  75.       printf(" Author:%s from %s rejected.\n", msgBuf.mbauth,  msgBuf.mboname);
  76.       printf(" Id: %s  Date: %s  Time: %s  Room: %s\n",
  77.       msgBuf.mbId, msgBuf.mbdate, msgBuf.mbtime, msgBuf.mbroom);
  78.       bad++;
  79.       };
  80.     msg = atol(msgBuf.mbId);
  81.     printf(" %d out of %d messagges are duplicates\r", bad, total);
  82.     fflush(stdout);
  83.     };
  84.   printf(" %d out of %d messagges are duplicates\n", bad, total);
  85.  
  86.   }
  87.